package com.wkb.design.createModing.prototype.pojo;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;

/**  
 * @author wkb 
 * @version 创建时间：2013-6-14 上午10:43:15  
 * 类说明
 */
public class DayLife implements Cloneable , Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public DayLife() {
		System.out.println("我是构造函数");
	}

	/**
	 * 起床
	 */
	private String getUp;
	/**
	 * 坐公交
	 */
	private int byBus;
	/**
	 * 买早餐
	 */
	private String getFood;
	/**
	 * 中午小休一下
	 */
	private String noon;
	/**
	 * 下午工作
	 */
	private String afternoonWork;
	
	/**
	 * 下班回家
	 */
	private String goHome;
	/**
	 * 晚上休息
	 */
	private String night;
	
	/**
	 * 看电视
	 */
	private ArrayList<String> openTv;

	public String getGetUp() {
	
		return getUp;
	}

	public void setGetUp(String getUp) {
		this.getUp = getUp;
	}

	public int getByBus() {
	
		return byBus;
	}

	public void setByBus(int byBus) {
		this.byBus = byBus;
	}

	public String getGetFood() {
	
		return getFood;
	}

	public void setGetFood(String getFood) {
		this.getFood = getFood;
	}

	public String getNoon() {
	
		return noon;
	}

	public void setNoon(String noon) {
		this.noon = noon;
	}

	public String getAfternoonWork() {
	
		return afternoonWork;
	}

	public void setAfternoonWork(String afternoonWork) {
		this.afternoonWork = afternoonWork;
	}

	public String getGoHome() {
	
		return goHome;
	}

	public void setGoHome(String goHome) {
		this.goHome = goHome;
	}

	public String getNight() {
	
		return night;
	}

	public void setNight(String night) {
		this.night = night;
	}

	public ArrayList<String> getOpenTv() {
	
		return openTv;
	}

	public void setOpenTv(ArrayList<String> openTv) {
		this.openTv = openTv;
	}

	@SuppressWarnings("unchecked")
	@Override
	public DayLife clone(){
		/**
		*@version 创建时间：2013-6-14 上午10:49:04
		*@author wkb
		*/
		try {
			DayLife dayLife = (DayLife)super.clone();
			//为了深复制    -----非基本类型就需要进行深复制
			dayLife.setOpenTv((ArrayList<String>)this.openTv.clone());
			return dayLife;
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public DayLife ioDeepClone() {
		
		ByteArrayOutputStream byte1 = new ByteArrayOutputStream();
		ObjectOutputStream object = null;
		try {
			object = new ObjectOutputStream(byte1);
			object.writeObject(this);
			ByteArrayInputStream byteInput = new ByteArrayInputStream(byte1.toByteArray());
			ObjectInputStream objectInput = new ObjectInputStream(byteInput);
			return (DayLife)objectInput.readObject();
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}catch(ClassNotFoundException e1){
			e1.printStackTrace();
			return null;
		}
	}
	
	public void print(){
		
		System.out.println("----我的一天开始----");
		System.out.print(this.getGetUp());
		System.out.print(this.getByBus());
		System.out.print(this.getGetFood());
		System.out.print(this.getNoon());
		System.out.print(this.getAfternoonWork());
		System.out.print(this.getGoHome());
		System.out.print(this.getNight());
		System.out.println(this.getOpenTv());
		System.out.println("----我的一天结束----");
		
	}
	
}
